package fr.noe.amicaleloisirs.concours.utils;

import java.io.BufferedReader;
import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

public class ServletUtil {
	
	/**
	 * Recupere les donnees sous forme de String contenu dans la HTTP Request.
	 * 
	 * @param request
	 * @return
	 * @throws IOException
	 */
	public static String getStringDataInRequest (HttpServletRequest request) throws IOException {
		StringBuffer data = new StringBuffer();
		BufferedReader reader = request.getReader();
	
		String sCurrentLine;
		while ((sCurrentLine = reader.readLine()) != null) {
			data.append(sCurrentLine);
		}
		
	    return data.toString();
	}

}
